import socket

client_sk = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
ip_port = ('127.0.0.1', 9999)
client_sk.connect(ip_port)

while True:
    ret = input('请输入内容：')
    client_sk.send(ret.encode('utf-8'))
    if ret == 'bye':
        break

    # 接受服务端发生过来的数据
    content = client_sk.recv(1024).decode('utf-8')
    print('-->>', content)
    if content == 'bye':
        break

client_sk.close()
